var modelHighLight={
	setHighLight:function(objLists){
		ht.Style['highlight.color'] =deviceHighColor;
		g3d.setHighlightMode('selection');
		g3d.getHighlightHelper().setFetchTargetFunc(function(){ return objLists;});
		g3d.iv();
	},
	clearHighLight:function(){
		g3d.setHighlightMode('selection');
		g3d.getHighlightHelper().setFetchTargetFunc(function(){ return [];});
		g3d.iv();
	},
	/**
	*@author:luzhifei
	*@created:2019/09/28
	*@功能：判断是哪一种设备需要被高亮，并进行高亮
	*@注意: 本函数目前暂时适用于模型被加载的时候
	*/
	setModelHighLight:function(){
		let deviceTypeName='';
		let deviceTypeId=0;
		let openFlag='open';
		for (x in vm.rightcontentdata){
			if (vm.rightcontentdata[x].flag1==true){
				deviceTypeName=vm.rightcontentdata[x].name;
				deviceTypeId=vm.rightcontentdata[x].id;
				break;
			}
		}
		if (deviceTypeName!=''){
			this.setDeviceHighLight(deviceTypeName,deviceTypeId,openFlag);
		}
		
	},
	/**
	*功能：设置高亮
	*@param deviceTypeName  设备类型名称
	*@param deviceTypeId 设备类型id,取值1~8
	*@openFlag 打开标记 可以取值 close open 
	*/
	setDeviceHighLight:function (deviceTypeName, deviceTypeId, openFlag) {
		let realDeviceTypeName=deviceTypeName;
		if (deviceTypeName=='门禁'){
			realDeviceTypeName='门禁设备';
		}
		
		let mId=modelMap.curModelId;
		
		if (openFlag === 'close') {
			g3d.dm().each(function(item) {
				if (item._displayName === realDeviceTypeName) {
					if (item) {
						item.setScale3d(modelConfig.normalScaleArr);
					}					
				}
			})
			this.clearHighLight();	
            modelMap.lastHighLightDeviceTypeName='';			
		} else { //打开情况
		    //恢复上次高亮设备的大小
			g3d.dm().each(function(item) {
				if (item._displayName===modelMap.lastHighLightDeviceTypeName  ) {
					if (item) {
						item.setScale3d(modelConfig.normalScaleArr);
					}
				}
			})
			modelMap.lastHighLightDeviceTypeName=realDeviceTypeName;
			let highlightedDeviceList=new Array(0);			
			if (map.isGlobalScene) {
				$.ajax({
					url: '/jg-api/device/getDeviceList',
					type: 'post',
					data: {
						modelId: mId,
						deviceType: deviceTypeId,
						pageNo: 1,
						pageSize: 99999
					},
					success: function(res) {
						if (res.success) {
							g3d.dm().each(function(modelItem) {
								if (modelItem._displayName === realDeviceTypeName) {
									if (modelItem) {
										highlightedDeviceList.push(modelItem);
										modelItem.setScale3d(modelConfig.scaleArr);
									}
								}
							})
						}
					}
				})
			} else {				
				g3d.dm().each(function (modelItem) {
					if(modelItem._displayName) {
						if(modelItem._displayName === realDeviceTypeName) {
							highlightedDeviceList.push(modelItem);
							modelItem.setScale3d(modelConfig.scaleArr);
						}
					}
				})
			}
			this.setHighLight(highlightedDeviceList);	
		}

	}
};